package com.novoda.runbuddy.view;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;

import com.novoda.runbuddy.activity.Home;
import com.novoda.runbuddy.activity.Stopwatch;
import com.novoda.runbuddy.activity.TabsAdapter;
import com.novoda.runbuddy.provider.ActivityID;

public class HomeView extends LinearLayout {

	private Home	activity;

	public HomeView(Home home, ImageButton stopWatch, ImageButton diary) {
		super(home);

		this.activity = home;
		stopWatch.setOnClickListener(goToStopWatchListener);
		diary.setOnClickListener(gotoTodayListener);
	}

	private void switchToStopWatch() {
		Stopwatch.show(activity);
	}

	private void switchToToday() {
		Intent intent = new Intent(activity, TabsAdapter.class);
		Bundle extras = new Bundle();
		extras.putString("name0", "Today");
		extras.putString("tab0", "Today");
		extras.putString("name1", "Calendar");
		extras.putString("tab1", "Calendar");
		extras.putInt("default", 0);
		intent.putExtras(extras);
		activity.startActivityForResult(intent, ActivityID.TODAYJOGS);
	}

	private OnClickListener	goToStopWatchListener	= new OnClickListener()
													{
														public void onClick(View v) {
															switchToStopWatch();
														}
													};

	private OnClickListener	gotoTodayListener		= new OnClickListener()
													{
														public void onClick(View v) {
															switchToToday();
														}
													};

}
